package commands;

import bot.MyBot;

import modLoader.ModLoader;

import org.jibble.pircbot.PircBot;

public class Lmod implements Command {

	public String getCommandName() {
		return "lmod";
	}

	public void execCommand(String channel, String sender, String login,
			String hostname, String message, PircBot bot) {
		loadMod(channel, message, bot);
	}

	private void loadMod(String channel, String message, PircBot bot) {
		String mod = message;
		try {
			mod = mod.substring(0, 1).toUpperCase() + mod.substring(1);
		} catch (IndexOutOfBoundsException i) {
			return;
		}
		Command c = ModLoader.newInstance(mod);
		((MyBot) bot).getCommands().put(mod, c);
		bot.sendMessage(channel, mod + "-Module loaded");
	}
}
